Imports MyClasses
Imports System.Data
Imports System.Data.SqlClient
Public Class DReports
    Public Shared Function GetParentNode() As DataTable
        Dim StrSql As String = ""
        Try
            StrSql = "select RepCatId, RepCatNm, RepCatOrd from mrepcat where CatStatus = 'A' order by RepCatOrd"
            Return DbHelper.ExecuteDataTable(StrSql)
            'Return DbHelper.ExecuteDataSet(StrSql)
        Catch ex As Exception
            DGeneral.ErrorHandler(ex.Message, "DAL", "DReports", "GetParentNode", StrSql)
            Return Nothing
        End Try
    End Function
    Public Shared Function GetChildNode() As DataTable
        Dim StrSql As String = ""
        Try
            StrSql = "select RepId, RepNm, RepDesc, RepTitle, RepToolTip, RepFlName,RepCatId from mreports where RepStatus = 'A'"
            Return DbHelper.ExecuteDataTable(StrSql)
            'Return DbHelper.ExecuteDataSet(StrSql)
        Catch ex As Exception
            DGeneral.ErrorHandler(ex.Message, "DAL", "DReports", "GetChildNode", StrSql)
            Return Nothing
        End Try
    End Function
    Public Shared Function GetParentChildNode() As DataTable
        Dim StrSql As String = ""
        Try
            StrSql = "select mr.RepId, mr.RepNm, mr.RepDesc, mr.RepFlName, mr.RepCatId, mc.RepCatId, " & _
                    " mc.RepCatNm, mc.RepCatOrd from mreports mr JOIN mrepcat mc ON mr.RepCatId = mc.RepCatId" & _
                    " where mr.RepStatus = 'A' order by mc.RepCatOrd"
            Return DbHelper.ExecuteDataTable(StrSql)
            'Return DbHelper.ExecuteDataSet(StrSql)
        Catch ex As Exception
            DGeneral.ErrorHandler(ex.Message, "DAL", "DReports", "GetParentChildNode", StrSql)
            Return Nothing
        End Try
    End Function
    Public Shared Function GetChildNodeParmeter(ByVal RepId) As DataTable
        Dim StrSql As String = ""
        Try
            StrSql = "select ParaId,RepID,ParaNm,ParaOrder,ParaScrLbl,ParaScrCtl,ParaScrtype," & _
                    "ParaInput,ParaDfltVal,ParaSrc,tooltip from mreppara where RepId =" & RepId & " order by ParaOrder"
            Return DbHelper.ExecuteDataTable(StrSql)
            'Return DbHelper.ExecuteDataSet(StrSql)
        Catch ex As Exception
            DGeneral.ErrorHandler(ex.Message, "DAL", "DReports", "GetChildNodeParmeter", StrSql)
            Return Nothing
        End Try
    End Function
    Public Shared Function GetSelectRecord(ByVal sql) As DataTable
        Try
            Return DbHelper.ExecuteDataTable(sql)
        Catch ex As Exception
            DGeneral.ErrorHandler(ex.Message, "DAL", "DReports", "GetSelectRecord", sql)
            Return Nothing
        End Try
    End Function

End Class
